package com.wiki.gds.user.provider.modular.sys.controller;


import com.wiki.gds.base.web.controller.support.HttpKit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import javax.validation.constraints.NotNull;
import java.util.Random;

@RestController
@RequestMapping("message")
@Api(value = "MessageController",tags = "短信相关")
public class MessageController {

    @PostMapping("/push")
    @ApiOperation(value = "短信发送",notes = "短信发送",httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name="massageType",value = "短信类型",required = true,paramType = "query",dataType = "int")

    })
    public Integer sendMassage(@NotNull Integer massageType){
        int massageCode = new Random().nextInt(99999);
       if(massageType==1){
           HttpSession httpSession=HttpKit.getRequest().getSession();
           httpSession.setAttribute("MESSAGE-CODE",massageCode);
       }
        return massageCode;

    }

}
